changed the board creation code to avoid a huge mess when something goes wrong