should refactor this duplicated code