refactors angular controllers and views