Modified defines, added state machine beginnings