working implementation of custom ByteQueue