start to fix up csv generator
generalise guard function
factor more code back together
remove code left over from last commit