imporved listener thread