Now using generics

the connect and query functions are now using generics so that you can
immediately go through the result and will have autocomplete without
the need to cast the objects