Updated to work with Angular 1.2