Better type inference that doesn't break the tests also supports optional