add a ternary statement to Factory class