Adding Connection class and some optimization
Merge branch 'alternative'