Make monkeypatch code closer to production quality.