some refinements in js