crude, but sort of working. Something to come back to if refinements fsck it