Better IO implementation (I hope)