refactoring of Inspect._setup_fields
Merge branch 'performance-tweaks' into develop