refactor source code structure