added function for reading by line, dysfunctional