Deep refactor of SSH class so now it has less repeated code