Initial layout of connection-handler class and tweaking of main.