Cleanup validateSolution and remove unused helper functions.