Some cleanups to new merge_setting function based on