refactored type factory api to invoke factories; cleanup