refactor messageCatsWriter