Added computation of length