Minor: use implicit conversion
Minor: pattern matching