Add undoing function

Add undoing function, and make 'Coord' class.