cleaned up minimax