add some classes and minor refactor
Add connection form.
Some code refactoring.