add length procedure