Autossh service fix, Refactoring and some cleaning