Context. The solar chromosphere and the lower transition region is believed to play a crucial role in the heating of the solar corona. Models that describe the chromosphere (and the lower transition region), accounting for its highly dynamic and structured character are, so far, found to be lacking. This is partly due to the breakdown of complete frequency redistribution in the chromospheric layers and also because of the difficulty in obtaining complete sets of observations that adequately constrain the solar atmosphere at all relevant heights. Aims. We aim to obtain semi-empirical model atmospheres that reproduce the features of the Mg II h&k line profiles that sample the middle chromosphere with focus on a sunspot. Methods. We use spectropolarimetric observations of the Ca II 8542 A spectra obtained with the Swedish 1-m Solar Telescope (SST) and use NICOLE