added max_diff