Reformat tests a bit
Add n-of-a-kind function
Add tests for n-of-a-kind