working but slow, going to add threading