use threading instead of thread