This would be more efficient as a compiled pattern match