Implementation of queue