A little bit of code clean up. Added a shutdown function into generic.cpp