Add guards (as well as modulo and division, because I needed them)