some refactoring, support for dynect started