working version 1
while on circular buffer