renamed elementsOld to elements