Moved a section of my code to a new event