reorganized functions