added revwords and sort_domains functions