remove comment
fix typo
Compute length in separate function