refactored: extracted functions for message creation;