Added threading which kind of works.