threading now working, still some speed issues exist