reorganize source code