Can you move this up to line 283.  Make it clear that part is dealing with the downsampling and then after 282 is dealing with the new sample.