Change to use pattern match