Changed counter to use amount of objects in array