Added line merging for solution checking and log output