refactor angular controllers