Further tuning of the model and refactoring