created function to build buffers