separated out code for fiducial tracking