Slightly refactor cache header code