Runonce: Clean up code and remove globals