refactored n of a kind