implemented threaded version of agents