refactoring, jQuery version