Move all constants to the common header
State machine transitions closer to the specifications

+ rename states & extract constants