removing straight segments working