rename this function and re-document it with the new logic.