replaced some len commands