slight reordering of fns