finished prototype with msg.c