refactor reading config file