refactoring of ssh connection methods, general cleanup.