Added sample config and refactored code.