Refactored event listeners and functions separately.