finishing week5 except the optional function