refactored message method