fixup: refactor into a separate method