Convert fragments js code to coffeescript

Adresses #4