Refactored hover event and created clicked event