refactoring

- code deduplicate