Angularjs code clean up