adjusted locs reader to pre-calulate the number of lines