add Factory with unit tests