Almost working machine but only one state out of four works.