Refactored using send_cmd method
Misc fixes