Added treatment of line endings