Code tweaks to try to get this thing working

Switched from SSD to SAD
Rewrote the algorithm in a less rediculous way
Added file to re-rewrite it in desparation