more code fixes - moved the javascript into a coffeescript file