[#866] code refactor