Rewrote two methods (create type and create instance) in a recursive fashion to account for sub-objects.