Factor out repeated dereference

Makes the code more readable and efficient.

Change-Id: Ic7666b92dd562a8bddab22f63397a497e24bb9a5
Merge "Factor out repeated dereference"