Cleaned code. Added ssh command loop.