Refactoring queueMap