Add ability to play sounds.

- Also, minor cleanup and renaming of functions.