Fixed up some glaring python bugs. Added some more javascript.