added simple state machine to machine class for conditional execution.  May not work for nested ifs, depending on how bitcoin does it