Pass leaf indices to/from application, new Config class, replace Monitor class with a plain function MonitorLog.