added template, undoing, and saving maps code. fixed bugs.