rewrote metric checking. significantly faster now