Improvements to resolving generic types (nested types, partially bound types etc). This fixes issue #10