refactor code (+add Connection class)
resolve merge conflict