refactoring + initial autoconnect test

:)