changed for loop to start from 1