refactor for jquery exercise