Refactor complex method with duplicate computation

A lot of this method was duplicating processing. Pulled out the core
bit of the councils map to be called earlier to reduce how often it's
run.

The main reason this was done was to make it clearer what the code was
doing and to simplify where possible.