refactored a bit to reduce length of IF
do not produce code block if empty line is missing