Sped up extremely.

safeButtonCounter outside of two extra loops