Modify bufferHandler, added comments