  The inference of the underlying state of the plasma in the solar chromosphere
remains extremely challenging because of the nonlocal character of the observed
radiation and plasma conditions in this layer. Inversion methods allow us to
derive a model atmosphere that can reproduce the observed spectra by
undertaking several physical assumptions.
  The most advanced approaches involve a depth-stratified model atmosphere
described by temperature, line-of-sight velocity, turbulent velocity, the three
components of the magnetic field vector, and gas and electron pressure. The
parameters of the radiative transfer equation are computed from a solid ground
of physical principles. To apply these techniques to spectral lines that sample
the chromosphere, NLTE effects must be included in the calculations.
  We developed a new inversion code STiC to study spectral lines that sample
the upper chromosphere. The code is based the RH synthetis code, which we
modified to make the inversions faster and more stable. For the first time,
STiC facilitates the processing of lines from multiple atoms in non-LTE, also
including partial redistribution effects. Furthermore, we include a
regularization strategy that allows for model atmospheres with a complex
stratification, without introducing artifacts in the reconstructed physical
parameters, which are usually manifested in the form of oscillatory behavior.
This approach takes steps toward a node-less inversion, in which the value of
the physical parameters at each grid point can be considered a free parameter.
  In this paper we discuss the implementation of the aforementioned techniques,
the description of the model atmosphere, and the optimizations that we applied
to the code. We carry out some numerical experiments to show the performance of
the code and the regularization techniques that we implemented. We made STiC
publicly available to the community.
