update week2 code by chenhao