cleanup and reorg
add map
save before leave