removed inarg 'mod' to subfunction as it is not needed.