simplify code by introducing setConfig method.