might change this to an ```angular.forEach``` to make it more readable, I was still naive to angular utilities when writing this