optimizations, parsing lengths