Change condition to compare to QUEUE_SIZE - 1