Added auto registration of classes if they have not already been registered.