refactoring & moving shit to coffeescript