do better pattern match