Cleaning up events, preparing for sub programs