Updated Factory class.