small adjustment for the loop in dump function
Use anonymous namespace instead of global static function