Allow bufferSize to be specified, instead of being hardcoded