Moved Undo button to history fragment and fixed logic to delete the last action. The query now looks for the last UserAction with an attached UserActionImage.