Remove ad-hoc 'dump_object' method.
Remove some redundant code; improve tests.