changed from float64 to float32 for memory efficiency