more haphazardry, speculative pseudo-code