modified factory.cpp comments