#647 code refactor
#647  code refactor