#7 added length function