refactoring of inspect(): phase 2