Refactoring jQuery proxy