reorganized the code
reorganized the code