refactory it's js