Optimizes config