fix logic and speed way up
it looks like hashing was happening at the wrong time, causing waaayyy more computation than necessary.