Use a seperate class for the shutdown function.