merger and sampler both work now, without any valgrind errors
reinline a few functions