Queue refactor