Code refactoring: use the new run_cmd and avoid code duplication. Fixed double carriage return when returning results. Added new blocking command mode - useful in some cases (not used for now)
Merge pull request #1 from ojacques/master

Code refactoring: use the new run_cmd and avoid code duplication.