Remove unnecessary transitions.