Updated to work with Angular.js 1.2.16