Added code to remove threads when paused and start them on run