Finalize ground truth extraction code