add debug printouts for testing. for testing, use %k vals to calculate %d instead of smoothed %d.