Simplify sanitizing code