Start testing connection, rewrite tests, some fixes