Gutted the javascript with heavy semantic and syntactic refactoring. Currently very broken, lots of kinks to smooth out.