Removes some conditionals in favor of pattern matching functions