readability changes and bugfixes
updated to match changes in board.cpp