Rewrote AngularJS controllers and services