Rename and refactor match state to be immutable more often.