Define safetail using pattern matching.