anchor.diff:  %% -------------------------------------
   
   %% ------------- SSH calls -------------
  -% ssh to host using key_pool, ane execute all given commands
  -call_commands_on_host(_Host,_KeyPool,[]) ->
  -	ok;
  -call_commands_on_host(Host,KeyPool,[Command|Rest]) ->
  -	print(Host++": "++Command),
  -	Ans = os:cmd("ssh "++parse_key_pool(KeyPool)++" "++Host++" "++"'"++Command++"'"), % ssh -i key1 -i key2.. user@host 'command'
  -	print(Ans),
  -	call_commands_on_host(Host,KeyPool,Rest).
  +% checks if ssh connection can be established and simple command can be executed
  +connection_ok(Host,KeyPool) ->
  +	case call_command_on_host(Host,KeyPool,"test 0") of
  +		{0,_} -> true;
  +		_ -> false
  +	end.
  +
  +% tries to connect with given list of keys and executes command on host
  +call_command_on_host(Host,KeyPool,Command) ->
  +	debug(Host++": "++Command),
  +	Result = os:cmd("ssh "++parse_key_pool(KeyPool)++" "++Host++" "++"'"++Command++"'" ++ ";echo *$?"), % ssh -i key1 -i key2.. user@host 'command' ; echo #$?
  +	Ans = get_answer(Result),
  +	RCode = get_return_code(Result),
  +	debug(Ans),
  +	{RCode,Ans}.
   
   %parse key_pool to ssh format (-i key1 -i key2...)
   parse_key_pool([]) ->
  
positive.code: parse_key_pool([Key1|Rest]) ->
  	" -i "++Key1++parse_key_pool(Rest).
  
  
  %% -------------- Printing -------------
  debug(Text,Args) ->
  	case get(debug) of
  		true ->
  
negative.code: print(Text) ->
  	print(Text, []).
  print(Text,Args) ->
  	io:format(Text++"~n",Args).
  print_error(Text) ->
  	io:format(Text++"~n").
  %% -------------------------------------