WIP messages: general refactoring, fixes and improvements