moved private function for river into _elgg namespace