Updated code with instance config variable support