Clean up. Add support for non-primitive types.