utility func moved at the end.
doc updated.