Made map saving code cleaner