State substitution and shifting.