Miscellaneous tweaks to sound code