Made containsduplicates function more imperative by implementing hashsets rather than a link method.

This should have significant performance improvement over the previous implementation O(1) vs O(n).
Closes #5