Refactored state machine
EVERYTHING IS BROKEN