Adding delete-on-fail and some testing