changed length to end