minimax done, mem leak issues