refactor: remove duplicated codes