First cut of correlation logic (with debug)

Will be removing debug entries in follow-on commit