Minor type refactoring.
Wrote a small test for a case I was unsure of.  Seems to work.