Fixing up some javascript