Reimplemented the resampler with a more sane interface