Tweak to use variable instead of repeated lookups