Add unit tests
Use resolve instead of matching on each case