refined message logic