almost working hw7, try indexing from 0