Functional Programming: handle line terminator