integrated pedometer, clean up code