cleaned up coffeescript a bit for bugfix