New state machine
Beter python reference