refactor unique to use .uniq instead of array & array
clean up comments and test cases