Migrate the Kalman filter to library