Added code to calculate number of steps