more tidying up with type classes