refactor queue impl