Better types, auto derived type class and some tests.