A simple implementation allowing 4 states