SoX Wrapper: Some code refactoring and some memory optimizations.