completed kalman filter implementation