implementation from tutorial at http://www.toptal.com/angular-js/a-step-by-step-guide-to-your-first-angularjs-app