remove loop stuff and use more threading