This branch is _massive_.  Please refactor into a method.