[MH,RG] Add some functions for the undo button, like to undo the switch layout and add some unit tests