Refactoring code for new project structure