fix my crappy javascript