Rough convertion from Coffee script to JavaScript