move helper function closer to use; NFC