Refactor the guard condition into the newline function