Refactored global variables and event listeners