Branch visitors for detecting and mutating branches.

This PR replaces #547. The branch has been renamed to correspond to the name of the main file this adds.  I have addressed most of the comments that were still open in #547, and made some modifications that are dependent on PR #551.

Aren't these calls to mutate redundant? It looks like this already happened on lines 447 and 453. Is it actually necessary because the simplify might cause more possibilities?