Ref #6: Refactor addTableLines and ensureColumns: functions