some more perf tweaks plus adapting an old sample to the new style