Ported render script to CoffeeScript