new working version of buffer