My coding followed a specific talk which didn't go at all into why these particular gates are useful.
Once I grok that, I'll improve the code.