added final_stats hook as well