replacing type codes with states