Added in proper code for self loops, now need to debug perf.