remove code duplications