Added shell escaping and logic to ignore deletions