better error handling, update SSH logic