added a length function