changed logic for messages