Reorganised namespaces.
Added polyfill/shim so that .bind on functions works.
Changed logging so that some messages can go to the inbuilt console.