Replaced all floats with doubles because precision