converted to coffeescript, also separate file