Tidy up and bug fix for deletion of unsaved task