Add emFitParameters function and re-organize a little