Some work on a proper shutdown sequence