Finished rewrite of resampler into something usable