Small tweaks and optimisations, added more docs and a build script for making docs and mimified javascript.