updated codes from week 3