done step1 and stated step2 of cs431 alg