Fix reference to reference problem in hawick_circuits.
Refactor the hawick_circuits algorithm.
Micro-optimize the hawick_circuits algorithm.