much tidying of the javascript library, just levaing what I actually used