Added logic for updating history while inserting and deleting bases