Add explanatory comments and simplify mod_zero