Wrote calculate_stats and execute_master