initial work for buffering