Added threads for looping