don't really need four states
vector of pairs is simpler