cleanups and better log messages