duplicated code deletetion