refactored queue