simplifying c+p code