issue #2 fixing the api, replacing the length class member with end