Added more structure and fixed small bugs in transmit.c
Added many comments to generator.c