X-ray observations are a direct diagnostic of fast electrons produced in solar flares, energized during the energy release process and directed towards the Sun. Since the properties of accelerated electrons can be substantially changed during their transport and interaction with the background plasma, a model must ultimately be applied to X-ray observations in order to understand the mechanism responsible for their acceleration. A cold thick target model is ubiquitously used for this task, since it provides a simple analytic relationship between the accelerated electron spectrum and the emitting electron spectrum in the X-ray source, with the latter quantity readily obtained from X-ray observations. However, such a model is inappropriate for the majority of solar flares in which the electrons propagate in a hot megaKelvin plasma, because it does not take into account the physics of thermalization of fast electrons. The use of a more realistic model, properly accounting for the properties of the background plasma, and the collisional diffusion and thermalization of electrons, can alleviate or even remove many of the traditional problems associated with the cold thick target model and the deduction of the accelerated electron spectrum from X-ray spectroscopy, such as the number problem and the need to impose an ad hoc low energy cut-off.