Now this works right, with complete heuristic for R