corrected  and tested  all for method 1 with case1 and case2