Removing unused variable and event handler