Broke parser into its own function, added CSV writer and IO