add the code & tests of phase1