Extracting stuff to type classes