Refactor code to add inspection dialog.