### What problem does this PR solve? Refactor code, improve performance ### Type of change - [x] Refactoring Signed-off-by: Jin Hai <haijin.chn@gmail.com>