We have multiple places we do these two non-trivial operations together, let's introduce a unified helper for doing both at once.
Just some minor reorganiztion.