Refactor to start unit test development.

Large refactor, just wanted to move a single function out of architect.c so I
can isolate it for unit testing. However there was a fair bit of dependency
cruft that needed to be sorted out as well.

A number of new files were created to try and seperate the code between the
original and my refactoring. The function is now in map.c, besides updating the
parameter list, nothing else has been done yet.