Implemented length using reduce