refactor code base on pr