refactored common show message function so that is is generic