extract shutdown functionality to its own class