SSH: refactored