Refactoring smart config and related utilities