Improvement in classes and fitting routine