finish debugging problem1
finished problem3, need to verify final result