Improve in second example of simple factory