Added error catching to getThreads