added cleanup code for rejections