Added statecode variable.