Code review changes for matrix range checks.