Minor refactoring in peer message handler