updated to not use global variable, using angular.module('legendary') syntax instead