fixed up JS some more