Refactoring on saving dirty map