added heuristic seeding; outputs to file at each iteration