length collecting and storing