Replaced Vec<f32> with fixed-size array for faster performance, other small optimisations.