improve for the case the number of buffers is 3