slight jquery refactor