finished dump function (used when dumping scope contents), code cleanup