Made reading in a function.
Made into a function.