Refactor distance.c and update input and base csvs