further tidying generator
function generator tests working