refactor the source code