added more cleanup code