Fixed bugs, changed floats to doubles