Refactoring
Added unit test for deduplication