Add generic functions safe_division, add_array and sum_array