Remove dead code, old code and build in some logging.