Fixes for sending in commands reliably. Cleanups, pycharm code inspection fixes, updated commenting.