mega changes mostly for fitHMM and new models. Also changes for new
optimx version