Use dynamic binding instead of pattern matching.
Shorten code in some places by using Dynamics.fromFunction