Added ssh scaffold; involved a bit of refactoring