Basic shutdown code added
Easier to maintain files for separate directories now. Just add the appropriate
entries in the directory Makefile.