Added GetThreads function and updated SendCommand