Refactoring to separate GUI and logic. Also changed it to use memory streams for recording the wav file, as opposed to disk.