Refactor access check headers.

Make sure the tests pass under low memory and no memory overcommit.