Fix event handling for deletion of files. Tidy-up.