fix for #242

I added some code to id the parts and be able to delete the correct ones.
String.replace() used to remove the first occurrence of a search term and also left double spaces occasionally.