map cleaning code