made improvements to step counting algorithm