corrected totalsteps variable initialization