changed floats to doubles for accuracy reasons