implementation of queue