fixed factory.cpp and factory.h
update order