Rewrote instance tracker. Now uses InstanceTracker class and a hashmap
for speed.