Use 'prev' variable in rest of code

Only two places at this point