converted scripts into coffeescript and moved into external files