Changed to make sure n > 0.