Got buffer working - needs some more testing