Replaced implicit implementation of mod(x, m) with call to aforementioned