Adding back the modulo operation that was lost by Fredrik's commit.