Changed Iterator sequences to enhanced for loop for clarity and less code. Changed how contact ids are assigned.