removed extra variable i that was not needed in the program