add Factory
and algorithm