moved sum_exp to utilities