removing loose ends