Continue refactoring. Improve logging.
Forgot to add.