removed unneeded loop for properties and replaced with simple check on the newest element in the array