PLD: io refactor and tests