deep refactor of config reader