Added instrument parameter to publishSynth
Fixed invalid memory access and other minor cleanup