added debug functionality and improved configuration based app
behaviour.