move ssh into class and some fixes