fixing javascript because it's fkn horrible