added connection support, dynamic menu, refactoring