refactoring + flac support