Fix in-place removal
Prevent duplicate nodes in repos
Avoid resorting multiple times
Merge pull request #445 from AudriusButkevicius/dupes

Fixes and improvements