Refactor to return Config, error pair.