refactorint the Jquery