Changed sum to Double so that it can return a non-numeric value upon failure