Rewrote the contact getting code to make it much faster

Took 4:30 minutes before now takes 10 seconds.