removing extraneous end