Added a recursive length function