fixed issue where it was not correctly removing duplicates, and also cleaned the code up a bit
Merge pull request #464 from nlake44/prefix-fix

fixed issue where it was not correctly removing duplicates, and also cle...