Code cleanup
Refactored click event