Including Suresh's fixes for StateCodes