add a build script and package file, tidy up some of the core code (especially the masses of html strings)