finalizing history table logic