moved queue implementations together