Rewrote to check that it's within the range 1 - {queue_length} now.