Moving all clean up actions into one method. (for #39)