Implemented undo and redoing and also made a few UI adjustments