Javascript optimizations

There were some JavaScript optimizations that could be done.