tidy up the doco and fix the function.