Added a flag for line count
Added ability to read variable number of lines