rewrite the queue code

Link: https://github.com/GeneAssembly/biosal/issues/292
Signed-off-by: Sébastien Boisvert <boisvert@anl.gov>