`mod` is an unused local; you can remove it, I think.