cleaned up and added some comments. getdist and getprev are the same now
yay!!!