Map and instances saving code.