get rid of angular.forEach because it's slower than for-loop