small js optimization