reorganized code
reorganized code