factoring out old queue codes