Refactors Config class.

Its behavior is still the same.