refactoring code into angular file structure