added state code decoder