added some code to cleanup after the processing