First attempt to port to Angular 1.0