preparation for pattern match