Refactoring buffer handling; New class IOBuffer for intermediate storage.