reafactoring in favour byteBuffers