Fixes a bug that causes dispose to be triggered multiple times

Refactor coffeescript to conform to syntax as other similar projects.
Move dispose trigger outside of the _.each iterator.