Used the more idiomatic 'each_line'
Applied default values and descriptive names
used with_index() instead to manage index offset