CoffeeScript implementation for grid