Improving config handling code