The floatmax datatype was causing problems, so i changed it to float64 everywhere