Rewrite clone counting to use one map instead of two