made js more efficient