added length function.