Simpifies file sort code.
Check for modifications cleanup after each command.