Improved loadElements to only replace an element if it finds it.