Added terminate handler to the state object to handle signals; Split command executor into setup and result phases