moved TextWindow to main. Moved connectsock code to own file.