improved on_demand mode