[Refactor] Remove duplicated code