Fixed connection, encryption needs rework, cleanup