reduce duplicated logic