major refactoring (connection); api 1.0.1; bugfixes