Implemented undoing for drawing and erasing