[#121] Extract common io functionality