Several improvements to queue class