remove redudant code and update more complicated test case