WIP messages: general refactoring, fixes and improvements

Please sort imports - external, `invenio`, module ...