remove unused stuff and dead ends