remove repeat code