Implemented repeat modes

Also don't crash if queue is empty