stack in form of ring buffer (use a counter is more easy)