class library: patterns: minor optimization of cleanup