copying over from board-script.js