Rotate Function + Prio Queue