Improve the clarity of the totalLength assignment