refactore the source code