Yes, I imagine that's not the most elegant way of creating new objects of a class given its name. How should it be done instead?