Refactor a security check.