Some js improvements