Recalculate the percent properly. Also, changed float to double.