Improved "guard" snippet.