Implement resonant circuits, replace repetitive code with function, add M suffix