Refactored using AngularJS