Refactor, log everything, config cleanup.