major cleanup javascript