refactored code in this exercise using jQuery mouse events