Implemented main config logic and tests.