Implement factory

Allow factory to create form with name class or an object.