Adding a new function for buffering