add logging to ssh command
some refactoring