minor changes in kalman calculation