First crack at precision/recall. Code not tested yet.