Refactor and simplify config_reader