Refactor messages, logging