Added threads and listener