Removed cruft, cleanup, add Port type.
Random Board function and tests.

This commit also includes the definitions of some Module level
constants and reference lists.
Refactor to make intermediate tests pass.

As the code is growing, it is important that the tests grow as
well. By hitting some code paths I found inconsistencies and
bugs. This commit fixes some of those.