partial implementation of Queue