Refactored project structure and added to model logic