Also taking a look at your code right now, the condition for the while loop to run is if board_updated = 1;

But your if statement sets board_updated = 1 if vara == 1. Does this mean board_updated was never equal to 1 in the first place? If so, then your while loop would never run. If not, then make sure the function calls your making actually work so that it can exit the loop at some point after getting the correct return value from the function