Tiny refactor to move something into a function.