refactor minimax
Tidy up a little