First passing state Machine tests and implementation