Alex's fiducial code plus some small fixes from

Merging immediately