added code for cleaning up