code updated, thread dont have exit procedure for now