Refactor jquery