Did some nice reworking with a trait and pattern matching, all tests pass