more tidying up, still work in progress