refactored synchronized queue