Working on porting to AngularJS