Complete implementation with local testing