Switched to doubles internally, added %f formatting
Repaired formatting with some sed