standardized output and comments, optimized sol.