JavaScript improvements