Refactor Angular Controller.

Added comments, split methods, added error handlers.