Please add explanatory comments, for example, about which arguments are read from and which are written to. Consider using 'const' for the former.