Restored cleanup routines into each function
Corrected some typos for cleanup routines
Merge pull request #39 from chuckleb/master

Restored cleanup scripts to functions