Modified to use AngularJS.