Added function to build message headers