Minor cleanup and attemp to fix hash thread not ending