Added guard code to prevent out of bounds array accesses when the full 1000 objects don't really exist.