Added function to clean up failue