Modified to use coffee-script with generator support