Ensure encrypted value is less than modulus, other minor fixes.