refactoring jquery