Converted compile function into coffeescript