Added parameter estimation code, initial modifications