Reorganized functions and added clear_board()