implemented threading and stuff....