Shutdown refactoring example

This is a sample of what should be done for all state machines.

Posting it just to be sure that we mean the same thing.