Added Thread management