Additional cleanup as well as fixing shutdown.

Signed-off-by: Chris Sanders <zidane@outlook.com>