removed NIO byte buffer usage and added internal implementation of bytebuffer