use .each instead of .each_line

Using the .each method with an array is much cleaner.