Memory optimization: Removed the storage of the Kalman gain since it was not needed.