Javascript improvements