code refactoring, adjust the the overall structure.