Corrected mistake in config.
Code clean-up and refactoring.