Remove threading and replace with time.sleep