Likely a better solution exists, not sure if its worth it. maybe worth a strong comment at the top mentioning why io is performed in here?