2nd edit  public code for use in our testcase