extracted shim and added debugOnly flag