changed list to use contactsLength in for loop