Implemented CoffeeScript classes in the proper way

And done some tidying