Refine initMessageFunctions