Restructure software and add CSV output.