all coffeescript converted to plain javascript