Wrapped function in main(), cleaned up some, added new types
Made output file csv
Chnaged printing output