Got the encoding of the raw data into a WAV format to work and tested it. Made some other small clean up changes.