Add a class for handling connections.
Move type preparation to the Connection.
Add more API docs.