Changed the API to make it look like nodejs.
Made it work with requirejs, cleaned the code.