added final state feature and re-generated code