refactoring the front-end code, using angular. WIP