io code to read lines from files