Main implementation: