Made js libraries local. Fixed a number of bugs.