implemented a version of lineCount by pulling the line_count variable to the outer scope