Rewrite of previous queue script.