move demo js to js files, fix a couple issues with the demos