Move repeated elements to private method