Module support

Support for AMD and CommonJS
Log function changes

Public option and a public function to set the log function is added
Changes in the README