[REFACTOR] removed duplicated code