remove code duplicated