Refactor primal heuristic