changed to use a buffer
changed to use a buffer