fixed a bug with line break; refactored line population