refactoring. more targeted message handler