Some js optimization