Changed sprintf to snprintf and added a lot of structure to transmit.c