starting to refactor for minimax usage