updated code to account for the list being too long