bug in heuristic part. used '^2' as raised to thw power of 2 when it's actually xor