optimizing configurator code