Refactoring project structure, angular behaviour and html behaviour