split big function up
don't send null terminated strings, and null terminate all incoming strings