replaced forEach's with coffeescript loops