Bug 1081597: Refactor some branches. r=rnewman

Reviewed on bugzilla.