We present recent experiments using a Levenberg-Marquardt algorithm and the polarised radiative transfer code COSSAM to produce a new ZDM code. Currently the code is able to recover the magnetic parameters of model stars with either a decentred dipole morphology or a morphology consisting of a centred dipole and a quadrupole, while simultaneously calculating multiple chemical abundances (including a basic stratification model). The ZDM code has been tested using both synthetic spectra and real, well studied stars. Additional features are currently being added such as a multipole morphology of arbitrary order and more sophisticated chemical stratification models.