reorganized some source code.