added queuesize as parameter