refactor some jquery