make this two different buffers and add control variable to inner loop