Refactor queue_xqueue