switched project structure and refactored code