Added function to count lines in a file