Optimized code output by trimming more than two empty lines to one empty line.