begin message handler code