Rewrote code to use MessageType.h