implemented crude buffering