refactor with n_of_a_kind?