modifications to adapt to AngularJS