fixed unique, added tests for all the functionality we need