Improved io interface.

Change-Id: Ib9a7117a93ffe3354a4fcc785852888a1d699d1f