fixing config file syntax
code re-structure - reduce the size of try/catch block