Support for large boards

Cleaned up the code, removed some references to literal values, added
support for large boards