minor poking about
huge-ass refactor