facotry function related materials are all aggregated into factory.cpp. Related modifications to the files are made.