added buffer functionality