Queue implementaiton refactor