works for naive cases without bitset