Updated factory class