use threads correctly, thanks to @ysulsky