bonus exercise 8
fixed index issue